package com.example.ang.tripapp.utils;

import android.app.Activity;

import java.util.LinkedList;

/**
 * ***********************************************************
 * author: andy
 * time：15/12/1
 * name:Activity工具类
 * step:
 * *************************************************************
 */
public class ActivityUtils {
    private static LinkedList<Activity> mActivityList = new LinkedList<>();

    /**
     * 添加Activity
     *
     * @param activity
     */
    public static void addActivity(Activity activity) {
        mActivityList.add(activity);
    }

    /**
     * 删除的Activity
     *
     * @param activity
     */
    public static void removeActivity(Activity activity) {
        mActivityList.remove(activity);
    }

    /**
     * 销毁所有Activity
     */
    public static void destroyActivity() {
        for (Activity activity : mActivityList) {
            activity.finish();
        }
    }

    /**
     * 退出应用
     */
    public static void exitApp() {
        for (Activity activity : mActivityList) {
            activity.finish();
        }
        //杀死当前应用的进程
        android.os.Process.killProcess(android.os.Process.myPid());
        //退出程序
        System.exit(0);
    }

    /**
     * 跳转到下个Activity的动画
     *
     * @param activity 当前的Activity
     */
    public static void startNextActivity(Activity activity) {
        //finish掉当前的Activity
//        activity.finish();
//        activity.overridePendingTransition(0, 0);
    }


}
